package com.hqyj.exception;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import java.util.HashMap;

/**
 * 项目:demo-springboot-230701
 * 描述:
 * 时间:2023/9/27 8:27
 * 作者:admin
 * 版本:1.0
 **/
@RestControllerAdvice(basePackages = "com.hqyj.controller")
public class UserInfoControllerAdvice {

    @ExceptionHandler(UserInfoException.class)
    public HashMap<String,Object> UserInfoException(UserInfoException e){
        HashMap<String,Object> map = new HashMap<String,Object>();
        map.put("code",e.getCode());
        map.put("msg",e.getMsg());
        map.put("info",e.getMessage());

        return  map;
    }
}
